package com.junjun.ssm.text;

import com.alibaba.fastjson.JSON;
import com.junjun.ssm.dto.UserDto;
import com.junjun.ssm.service.serviceImpl.MeiTuanServiceImpl;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class MQT {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Autowired
    MeiTuanServiceImpl meiTuanService;

    @Test
    public void TopicExchange() {
        UserDto userDto = new UserDto();
        userDto.setUserName("奥特曼");
        userDto.setPassword("11111");
        String json = JSON.toJSONString(userDto);
        rabbitTemplate.convertAndSend("topicExchange", "movie", json);
    }

//    @Test//测试回调函数
//    public void Topic() {
//        UserDto userDto = new UserDto();
//        userDto.setUserName("奥特曼");
//        userDto.setPassword("11111");
//        String json = JSON.toJSONString(userDto);
//        meiTuanService.send(json,"001");
//    }

}